Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for constant time Greater-Than #8

Open
wants to merge 3 commits into
base: elligator2-ntor
Choose a base branch
from
Open

Conversation

jmwample
Copy link
Owner

No description provided.

@jmwample
Copy link
Owner Author

The kleshni encode test is failing now because its implementation actually fails this same issue. They use a ~direct subtraction w/ a check for overflow as a tests of greater than. However this doesn't account for the structure of the field where an unreduced field element of value, say $2²⁵⁵ - 1$ (equivalent to 18) as greater than 30, for example.

So for test cases exist for kleshni where a "subtract and check for overflow" implementation of greater_than differs from a proper implementation.

@jmwample
Copy link
Owner Author

jmwample commented Jul 31, 2024

This kind of shows that trying to accommodate a Legacy mode is not worth it. We don't even need an implementation of ct_gt() because it is actually just checking whether the FieldElement is negative or not, and we already have is_negative() for that. But is_negative() doesn't work for kleshni because they use the overflow of mpn_sub_n to check this.

Will decide how to proceed in the next commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant